//动态加载图片
(function($) {

	'use strict';

	var BootDynamicLoadPic = function(el,options){
		this.$el = $(el);
		this.options = $.extend(options);
		this.init = BootDynamicLoadPic.prototype.init;
		this.init();
	};

	BootDynamicLoadPic.version = '1.0';
	BootDynamicLoadPic.author = 'Mu Haitao';
	BootDynamicLoadPic.defaults = {};

	BootDynamicLoadPic.prototype = {
		constructor : BootDynamicLoadPic,

		init : function(){
			var bodyDatas = ["<img src='"+this.options.filePath,".jpg' alt='","'/>",
			"<a href='http://www.htmleaf.com' target='_blank' ></a>"];
			for (var i = bodyDatas.length - 1; i >= 0; i--) {
				console.log(i+":"+bodyDatas[i]);
			};
			for (var index = this.options.fileCount; index >= 1; index--) {
				this.$el.append(bodyDatas[0]+index+bodyDatas[1]+index+bodyDatas[2]);
			};

			$("img").wrap(bodyDatas[3]);
			$("a").wrap("<li></li>");
			$("li").wrapAll("<ul></ul>");
			$("ul").append("<img class='ri-loading-image' src='resources/loading.gif'/>");
			this.$el.wrapInner("<div id='ri-grid' class='ri-grid ri-grid-size-3'>");
			this.$el.wrapInner("<section class='main'></section>").wrapInner("<div class='container'>");		
			console.log(this.$el);
			return this;
		}
	};

	$.fn.bootDynamicLoadPic = function(options){    	
    	return new BootDynamicLoadPic(this,options);
    }
}(jQuery));